]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Explicitly highlight selected app icon
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 17 Nov 2021 23:25:48 +0000 (00:25 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 29 Jan 2022 00:16:29 +0000 (01:16 +0100)
While the menu is popped up, we artificially keep the icon highlighted
by ensuring it's hovered, and muting events on the app icon until the
menu is popped down.

This is somewhat convoluted and won't work with Clutter.grab(), where
it will be the menu itself that is the owner of input events while
shown, so cut some corners and explicitly tell the app icon to be
highlighted.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>

js/ui/appDisplay.js

index df8acbf7bd60f7b3bd6e2824a937d31e6b8c3cbe..79e8ef72b2ef499a2fa06e4ffebd28646baeca49 100644 (file)
@@ -1933,7 +1933,7 @@ class AppViewItem extends St.Button {
             label.disconnect(id);
         });
 
-        const expand = this.hover || this.has_key_focus();
+        const expand = this._forcedHighlight || this.hover || this.has_key_focus();
         label.save_easing_state();
         label.set_easing_duration(expand
             ? APP_ICON_TITLE_EXPAND_TIME
@@ -2081,6 +2081,14 @@ class AppViewItem extends St.Button {
     get name() {
         return this._name;
     }
+
+    setForcedHighlight(highlighted) {
+        this._forcedHighlight = highlighted;
+        this.set({
+            track_hover: !highlighted,
+            hover: highlighted,
+        });
+    }
 });
 
 var FolderGrid = GObject.registerClass(
@@ -3143,6 +3151,7 @@ var AppIcon = GObject.registerClass({
     }
 
     popupMenu(side = St.Side.LEFT) {
+        this.setForcedHighlight(true);
         this._removeMenuTimeout();
         this.fake_release();
 
@@ -3163,16 +3172,12 @@ var AppIcon = GObject.registerClass({
                 Main.overview.disconnect(id);
             });
 
-            // We want to keep the item hovered while the menu is up
-            this._menu.blockSourceEvents = true;
-
             Main.uiGroup.add_actor(this._menu.actor);
             this._menuManager.addMenu(this._menu);
         }
 
         this.emit('menu-state-changed', true);
 
-        this.set_hover(true);
         this._menu.open(BoxPointer.PopupAnimation.FULL);
         this._menuManager.ignoreRelease();
         this.emit('sync-tooltip');
@@ -3181,7 +3186,7 @@ var AppIcon = GObject.registerClass({
     }
 
     _onMenuPoppedDown() {
-        this.sync_hover();
+        this.setForcedHighlight(false);
         this.emit('menu-state-changed', false);
     }